package com.butterknife;

import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import androidx.activity.EdgeToEdge;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.graphics.Insets;
import androidx.core.view.ViewCompat;
import androidx.core.view.WindowInsetsCompat;

import com.butterknife.annotation.BindView;
import com.butterknife.annotation.OnClick;

public class MainActivity extends AppCompatActivity {

    @BindView(R.id.tv_txt)
    TextView tv;
    @BindView(R.id.tv2)
    TextView tv2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        EdgeToEdge.enable(this);
        setContentView(R.layout.activity_main);
        ButterKnife.bind(this);
        ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
            Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
            v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
            return insets;
        });
        tv.setText("333333");
        tv2.setText("222222");
    }

    @OnClick(R.id.tv2)
    void onShowToast(View view){
        Toast.makeText(this, "显示toast", Toast.LENGTH_SHORT).show();
    }
}